Index: Modules/posixmodule.c =================================================================== --- Modules/posixmodule.c (revision 72767) +++ Modules/posixmodule.c (working copy) @@ -4717,7 +4717,34 @@ } #endif /* HAVE_SYMLINK */ +#if !defined(HAVE_SYMLINK) && defined(_MSC_VER) && _MSC_VER >= 1400 +PyDoc_STRVAR(msc_symlink__doc__, +"symlink(src, dest)\n\n\ +Create a symbolic link pointo to src named dst."); + +static PyObject * +msc_symlink(PyObject *self, PyObject *args, PyObject **kwargs) +{ + static char *kwlist = {"target_is_directory", NULL}; + char **src=NULL, **dest=NULL; + int target_is_directory=0; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "SS|i:symlink", + kwlist, src, dest, &target_is_directory)) + return NULL; + + DWORD res; + /* TODO: if dest is a directory, ensure target_is_directory==1 */ + if (!CreateSymbolicLinkW(src, dest, target_is_directory)) + { + return win32_error("symlink", src); + } + Py_INCREF(Py_None); + return Py_None; +} +#endif /* !defined(HAVE_SYMLINK) && defined(_MSC_VER) && _MSC_VER >= 1400 */ + #ifdef HAVE_TIMES #if defined(PYCC_VACPP) && defined(PYOS_OS2) static long @@ -7080,6 +7107,9 @@ #ifdef HAVE_SYMLINK {"symlink", posix_symlink, METH_VARARGS, posix_symlink__doc__}, #endif /* HAVE_SYMLINK */ +#if !defined(HAVE_SYMLINK) && defined(_MSC_VER) && _MSC_VER >= 1400 + {"symlink", msc_symlink, METH_VARARGS | METH_KEYWORDS, msc_symlink__doc__}, +#endif /* !defined(HAVE_SYMLINK) && defined(_MSC_VER) && _MSC_VER >= 1400 */ #ifdef HAVE_SYSTEM {"system", posix_system, METH_VARARGS, posix_system__doc__}, #endif